package com.qinglei.recoup.hmp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qinglei.recoup.hmp.dao.HmpUserBindDeviceMapper;
import com.qinglei.recoup.hmp.domain.HmpUserBindDevice;
import com.qinglei.recoup.hmp.pojo.vo.DeviceVO;
import com.qinglei.recoup.hmp.service.HmpUserBindDeviceService;
import com.qinglei.recoup.system.pojo.PageParam;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author syp
 */
@Service
public class HmpUserBindDeviceServiceImpl extends ServiceImpl<HmpUserBindDeviceMapper, HmpUserBindDevice> implements HmpUserBindDeviceService {

    /**
     * 分页查询设备列表 默认设备在最上面
     *
     * @param param
     * @return
     */
    @Override
    public IPage<DeviceVO> selectDevicePage(PageParam param, Long userId) {
        Page<DeviceVO> page = new Page<>();
        page.setSize(param.getPageSize());
        page.setCurrent(param.getPageNum());
        return this.baseMapper.selectDevicePage(page, userId);
    }

    /**
     * 查询小程序已绑定的床位ID列表，仅包括健康报告开关开启的
     *
     * @return
     */
    @Override
    public List<Integer> selectBedIds4HealthReport() {
        return this.baseMapper.selectBedIds4HealthReport();
    }
}
